package com.tbi.graphcolouring.testers;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

public class CollectionsTest {
	public static void main(String[] args) {
		final int SIZE = 50000;
		
		List<String> llist = new LinkedList<>();
		List<String> alist = new ArrayList<>();
		List<String> alistfixed = new ArrayList<>(SIZE);
		long start = System.currentTimeMillis();
		
		
		for(int i=0; i<SIZE; i++){
			llist.add(new String(System.currentTimeMillis()+""));
		}
		System.out.println("zapelnianie linkedlisty: "+(System.currentTimeMillis()-start)+"ms");
		
		start=System.currentTimeMillis();
		for(int i=0; i<SIZE; i++){
			alist.add(new String(System.currentTimeMillis()+""));
		}
		System.out.println("zapelnianie arraylisty: "+(System.currentTimeMillis()-start)+"ms");
		
		start=System.currentTimeMillis();
		for(int i=0; i<SIZE; i++){
			alistfixed.add(new String(System.currentTimeMillis()+""));
		}
		System.out.println("zapelnianie arraylisty (z podana wielkoscia): "+(System.currentTimeMillis()-start)+"ms");
		
		
		
		start=System.currentTimeMillis();
		for(int i=0; i<SIZE; i++){
			llist.remove((SIZE-i)/2);
		}
		System.out.println("usuwanie ze srodka linkedlisty: "+(System.currentTimeMillis()-start)+"ms");
		
		start=System.currentTimeMillis();
		for(int i=0; i<SIZE; i++){
			alist.remove((SIZE-i)/2);
		}
		System.out.println("usuwanie ze srodka arraylisty: "+(System.currentTimeMillis()-start)+"ms");
		
		start=System.currentTimeMillis();
		for(int i=0; i<SIZE; i++){
			alistfixed.remove((SIZE-i)/2);
		}
		System.out.println("usuwanie ze srodka arraylisty (z podana wielkoscia): "+(System.currentTimeMillis()-start)+"ms");
		
		
	}
}
